import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '社区名称',
    align: "center",
    dataIndex: 'communityName_dictText'
  },
  {
    title: '房产编号',
    align: "center",
    dataIndex: 'propertyNumber'
  },
  {
    title: '业主姓名',
    align: "center",
    dataIndex: 'ownerName'
  },
  {
    title: '账期',
    align: "center",
    dataIndex: 'accountingPeriod',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '门禁卡',
    align: "center",
    dataIndex: 'controlCard'
  },
  {
    title: '电卡补卡费',
    align: "center",
    dataIndex: 'electricCardReplacement'
  },
  {
    title: '电费',
    align: "center",
    dataIndex: 'electricityBill'
  },
  {
    title: '充电桩卡充值电费',
    align: "center",
    dataIndex: 'chargingStationCardRecharge'
  },
  {
    title: '清暖气过滤网',
    align: "center",
    dataIndex: 'filterScreen'
  },
  {
    title: '账单合计',
    align: "center",
    dataIndex: 'totalBill'
  },
  {
    title: '违约金',
    align: "center",
    dataIndex: 'weiyuejin'
  },
  {
    title: '合计',
    align: "center",
    dataIndex: 'zongji'
  },
  {
    title: '支付方式',
    align: "center",
    dataIndex: 'paymentMethod',
    customRender:({text}) => {
       return render.renderCategoryTree(text,'C03');
   },
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "社区名称",
    field: 'communityName',
    component: 'JSearchSelect',
    componentProps:{
      dict: ",,"
    },
    //colProps: {span: 6},
  },
  {
    label: "房产编号",
    field: 'propertyNumber',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "账期",
    field: 'accountingPeriod',
    component: 'DatePicker',
    //colProps: {span: 6},
  },
  {
    label: "支付方式",
    field: 'paymentMethod',
    component: 'JCategorySelect',
    componentProps:{
      pcode: "C03",//back和事件未添加，暂时有问题
    },
    //colProps: {span: 6},
  },
  {
    label: "缴费时间",
    field: "paymentTime",
    component: 'RangePicker',
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '社区名称',
    field: 'communityName',
    component: 'JSearchSelect',
    componentProps:{
      dict: ""
    },
  },
  {
    label: '房产编号',
    field: 'propertyNumber',
    component: 'Input',
  },
  {
    label: '业主姓名',
    field: 'ownerName',
    component: 'Input',
  },
  {
    label: '账期',
    field: 'accountingPeriod',
    component: 'DatePicker',
  },
  {
    label: '门禁卡',
    field: 'controlCard',
    component: 'InputNumber',
  },
  {
    label: '电卡补卡费',
    field: 'electricCardReplacement',
    component: 'InputNumber',
  },
  {
    label: '电费',
    field: 'electricityBill',
    component: 'InputNumber',
  },
  {
    label: '充电桩卡充值电费',
    field: 'chargingStationCardRecharge',
    component: 'InputNumber',
  },
  {
    label: '清暖气过滤网',
    field: 'filterScreen',
    component: 'InputNumber',
  },
  {
    label: '账单合计',
    field: 'totalBill',
    component: 'InputNumber',
  },
  {
    label: '违约金',
    field: 'weiyuejin',
    component: 'InputNumber',
  },
  {
    label: '合计',
    field: 'zongji',
    component: 'InputNumber',
  },
  {
    label: '支付方式',
    field: 'paymentMethod',
    component: 'JCategorySelect',
    componentProps:{
      pcode: "C03", //TODO back和事件未添加，暂时有问题
    },
  },
  {
    label: '缴费时间',
    field: 'paymentTime',
    component: 'DatePicker',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  communityName: {title: '社区名称',order: 0,view: 'sel_search', type: 'string',,},
  propertyNumber: {title: '房产编号',order: 1,view: 'text', type: 'string',},
  ownerName: {title: '业主姓名',order: 2,view: 'text', type: 'string',},
  accountingPeriod: {title: '账期',order: 3,view: 'date', type: 'string',},
  controlCard: {title: '门禁卡',order: 4,view: 'number', type: 'number',},
  electricCardReplacement: {title: '电卡补卡费',order: 5,view: 'number', type: 'number',},
  electricityBill: {title: '电费',order: 6,view: 'number', type: 'number',},
  chargingStationCardRecharge: {title: '充电桩卡充值电费',order: 7,view: 'number', type: 'number',},
  filterScreen: {title: '清暖气过滤网',order: 8,view: 'number', type: 'number',},
  totalBill: {title: '账单合计',order: 9,view: 'number', type: 'number',},
  weiyuejin: {title: '违约金',order: 10,view: 'number', type: 'number',},
  zongji: {title: '合计',order: 11,view: 'number', type: 'number',},
  paymentMethod: {title: '支付方式',order: 12,view: 'cat_tree', type: 'string',pcode: 'C03',},
};
